#include "src/Class/DrawClass.h"
void CDraw::Read(){
	ShowMessage(3, "Begin to read all input infomation.");

	ShowMessage(2);
	ShowMessage(3, "begin RWClass: read path.");
	this->path.Read_Path(this->steering_file);
	Jpath = true;

	this->file.Read_File(path);
	Jfile = true;

	ShowMessage(2);
	ShowMessage(3, "begin RWClass: read debug.");
	this->debug.Read_Debug(path);
	Jdebug = true;

	ShowMessage(2);
	ShowMessage(3, "begin RWClass: read flow.");
	this->flow.Read_Flow(path);
	Jflow = true;

	ShowMessage(2);
	ShowMessage(3, "begin RWClass: read signal.");
	this->signal.Read_Signal(path.signal_file);
	Jsignal= true;

	ShowMessage(2);
	ShowMessage(3, "begin RWClass: read event.");
	this->event.Read_Event(path);
	Jevent = true;
 
	ShowMessage(2);
	ShowMessage(3, "begin RWClass: read variables.");
	this->var.Read_Var(path);
	Jvar = true;

	ShowMessage(2);
	ShowMessage(3, "begin RWClass: read jet.");
  	this->jet.Read_Jet(path);
	if(this->flow.exclusive){
		int total_tag_num=0;
		if(this->jet.jets.SWITCH&&this->signal.NUM_jets==0){
			ShowMessage(2,"you open jet switch, but didn't set jet numebr!");
			exit(-1);
		}
		if(this->jet.bjet.SWITCH){
			total_tag_num+=signal.NUM_bjet;
		}
		if(this->jet.cjet.SWITCH){
			total_tag_num+=signal.NUM_cjet;
		}
		if(this->jet.qjet.SWITCH){
			total_tag_num+=signal.NUM_qjet;
		}
		if(this->jet.taujet.SWITCH){
			total_tag_num+=signal.NUM_taujet;
		}
		if(this->jet.tagjet.SWITCH){
			total_tag_num+=signal.NUM_tagjet;
		}
		if(this->jet.untagjet.SWITCH){
			total_tag_num+=signal.NUM_untagjet;
		}
		if(this->signal.NUM_jets!=total_tag_num){
			ShowMessage(2,"Error input: you set exclusive in flow.dat, but in cut/signal.dat, jets number != all tagged jet numbers", signal.NUM_jets,signal.NUM_bjet,signal.NUM_cjet,signal.NUM_qjet,signal.NUM_taujet, total_tag_num);
			ShowMessage(2,"Error input: jet switch", jet.jets.SWITCH, jet.bjet.SWITCH, jet.cjet.SWITCH, jet.qjet.SWITCH, jet.taujet.SWITCH);
			exit(-1);
		}
	}
	Jjet = true;
 
	ShowMessage(2);
	ShowMessage(3, "begin RWClass: read lepton.");
  	this->lep.Read_Lepton(path);
	Jlepton = true;

	ShowMessage(2);
	ShowMessage(3, "begin RWClass: read photon.");
	this->photon.Read_Photon(path);
	Jphoton = true;

	ShowMessage(2);
	ShowMessage(3, "begin RWClass: read met.");
	this->met.Read_Met(path);
	Jmet = true;

	ShowMessage(2);
	ShowMessage(3, "begin RWClass: read combine.");
	this->comb.Read_Combine(path);
	this->comb.comb_cuts.Print();
	this->comb.Set_Comb_Cuts();
	Jcombine = true;

	ShowMessage(2);
	ShowMessage(3, "begin RWClass: read recoil.");
	this->recoil.Read_Recoil(path);
	Jrecoil = true;

	ShowMessage(2);
	ShowMessage(3, "begin RWClass: read tag.");
	this->tag.Read_Tag(path);
	Jtag = true;

	ShowMessage(2);
	ShowMessage(3, "begin RWClass: read global.");
	this->global.Read_Global(path);
	Jglobal = true;

	ShowMessage(2);
	ShowMessage(3, "begin RWClass: read jet substructure.");
	this->jetsub.Read_JetSubStructure(path);
	Jjetsub = true;

	ShowMessage(2);
	ShowMessage(3, "begin RWClass: read jet massdrop.");
	this->MassDrop.Read_MassDrop(path);
	JMassDrop = true;

	ShowMessage(2);
	ShowMessage(3, "begin RWClass: read jet nsubjettiness.");
	this->NSubjettiness.Read_NSubjettiness(path);
	JNSubjettiness = true;

	ShowMessage(2);
	ShowMessage(3, "begin RWClass: read jet boost tag.");
	this->BoostTag.Read_BoostTag(path);
	JBoostTag = true;

	ShowMessage(2);
	ShowMessage(3, "begin RWClass: read jet JEP.");
	this->jep.Read_JEP(path);
	Jjep = true;

	ShowMessage(2);
	ShowMessage(3, "begin RWClass: read detector simulation parameter.");
	this->detector.Read_Detector(path);
	JDetector = true;

}
